package cn.xjfcloud.onedriveserver.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import cn.xjfcloud.onedriveserver.pojo.dto.OnedriveFileInfo;

@Mapper
public interface OnedriveFileInfoMapper {
	@Select("select * from tbl_onedrive_file_info where file_id = #{fileId}")
	OnedriveFileInfo getOnedriveFileInfoByFileId(String fileId);
	
	@Insert(value = "insert into tbl_onedrive_file_info (file_id,onedrive_path,file_name,file_size,upload_id,api_config_id) values (#{onedriveFileInfo.fileId},#{onedriveFileInfo.onedrivePath},#{onedriveFileInfo.fileName},#{onedriveFileInfo.fileSize},#{onedriveFileInfo.uploadId},#{onedriveFileInfo.apiConfigId})")
	Integer addOnedriveFileInfo(@Param("onedriveFileInfo") OnedriveFileInfo onedriveFileInfo);
	
	@Delete(value = "delete from tbl_onedrive_file_info where id = #{id}")
	Integer deleteOndriveFileInfoById(Integer id);
	
	@Delete(value = "delete from tbl_onedrive_file_info where file_id = #{fileId}")
	Integer deleteOndriveFileInfoByFileId(String  fileId);
	
	@Select(value = "select * from tbl_onedrive_file_info where upload_id = #{uploadId}")
	OnedriveFileInfo getOnedriveFileInfoByUploadId(String uploadId);
	
	Integer updateOnedriveFileInfo(@Param("onedriveFileInfo")OnedriveFileInfo onedriveFileInfo);
	
	List<Map<String, String>> getAllUploadingFileInfo(); 
}
